update
This commit is contained in:
parent
2992f4f408
commit
4f46de8d00
3330 changed files with 394553 additions and 76939 deletions
196
.config/Code/User/History/-54951e98/0ECX.java
Normal file
196
.config/Code/User/History/-54951e98/0ECX.java
Normal file
|
@ -0,0 +1,196 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
217
.config/Code/User/History/-54951e98/1PKj.java
Normal file
217
.config/Code/User/History/-54951e98/1PKj.java
Normal file
|
@ -0,0 +1,217 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
214
.config/Code/User/History/-54951e98/3AN6.java
Normal file
214
.config/Code/User/History/-54951e98/3AN6.java
Normal file
|
@ -0,0 +1,214 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
resetStyles(username, password, info);
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
username.setStyle("");
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
111
.config/Code/User/History/-54951e98/3Uer.java
Normal file
111
.config/Code/User/History/-54951e98/3Uer.java
Normal file
|
@ -0,0 +1,111 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
217
.config/Code/User/History/-54951e98/5mK6.java
Normal file
217
.config/Code/User/History/-54951e98/5mK6.java
Normal file
|
@ -0,0 +1,217 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
200
.config/Code/User/History/-54951e98/6yUP.java
Normal file
200
.config/Code/User/History/-54951e98/6yUP.java
Normal file
|
@ -0,0 +1,200 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
207
.config/Code/User/History/-54951e98/7HYU.java
Normal file
207
.config/Code/User/History/-54951e98/7HYU.java
Normal file
|
@ -0,0 +1,207 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
username.setStyle("");
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
218
.config/Code/User/History/-54951e98/Anjw.java
Normal file
218
.config/Code/User/History/-54951e98/Anjw.java
Normal file
|
@ -0,0 +1,218 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
108
.config/Code/User/History/-54951e98/CoiS.java
Normal file
108
.config/Code/User/History/-54951e98/CoiS.java
Normal file
|
@ -0,0 +1,108 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = SceneCreator.createLoginScene();
|
||||
registerScene = SceneCreator.createRegisterScene();
|
||||
mainScene = SceneCreator.createMainScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
stage.setScene(mainScene);
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private static void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
111
.config/Code/User/History/-54951e98/DU1B.java
Normal file
111
.config/Code/User/History/-54951e98/DU1B.java
Normal file
|
@ -0,0 +1,111 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = SceneCreator.createLoginScene();
|
||||
registerScene = SceneCreator.createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
212
.config/Code/User/History/-54951e98/DX1l.java
Normal file
212
.config/Code/User/History/-54951e98/DX1l.java
Normal file
|
@ -0,0 +1,212 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
218
.config/Code/User/History/-54951e98/DpGy.java
Normal file
218
.config/Code/User/History/-54951e98/DpGy.java
Normal file
|
@ -0,0 +1,218 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
205
.config/Code/User/History/-54951e98/EgRE.java
Normal file
205
.config/Code/User/History/-54951e98/EgRE.java
Normal file
|
@ -0,0 +1,205 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
106
.config/Code/User/History/-54951e98/GN0U.java
Normal file
106
.config/Code/User/History/-54951e98/GN0U.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = SceneCreator.createLoginScene();
|
||||
registerScene = SceneCreator.createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private static void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
188
.config/Code/User/History/-54951e98/Gtcq.java
Normal file
188
.config/Code/User/History/-54951e98/Gtcq.java
Normal file
|
@ -0,0 +1,188 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setText("user not registered");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
info.setText("success");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setText("incorrect password");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
207
.config/Code/User/History/-54951e98/Jxcl.java
Normal file
207
.config/Code/User/History/-54951e98/Jxcl.java
Normal file
|
@ -0,0 +1,207 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
username.setStyle("");
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
208
.config/Code/User/History/-54951e98/KxLu.java
Normal file
208
.config/Code/User/History/-54951e98/KxLu.java
Normal file
|
@ -0,0 +1,208 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
username.setStyle("");
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
193
.config/Code/User/History/-54951e98/LQl0.java
Normal file
193
.config/Code/User/History/-54951e98/LQl0.java
Normal file
|
@ -0,0 +1,193 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setText("user not registered");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
info.setText("success");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setText("incorrect password");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
212
.config/Code/User/History/-54951e98/LYzI.java
Normal file
212
.config/Code/User/History/-54951e98/LYzI.java
Normal file
|
@ -0,0 +1,212 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
114
.config/Code/User/History/-54951e98/OyCc.java
Normal file
114
.config/Code/User/History/-54951e98/OyCc.java
Normal file
|
@ -0,0 +1,114 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.animation.PauseTransition;
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Duration;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = SceneCreator.createLoginScene();
|
||||
registerScene = SceneCreator.createRegisterScene();
|
||||
mainScene = SceneCreator.createMainScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
stage.setScene(mainScene);
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
PauseTransition pt = new PauseTransition(Duration.seconds(1));
|
||||
pt.setOnFinished(e -> stage.setScene(loginScene));
|
||||
pt.play();
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private static void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
208
.config/Code/User/History/-54951e98/PUil.java
Normal file
208
.config/Code/User/History/-54951e98/PUil.java
Normal file
|
@ -0,0 +1,208 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
username.setStyle("");
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
191
.config/Code/User/History/-54951e98/QyF5.java
Normal file
191
.config/Code/User/History/-54951e98/QyF5.java
Normal file
|
@ -0,0 +1,191 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setText("user not registered");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
info.setText("success");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setText("incorrect password");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
115
.config/Code/User/History/-54951e98/RSMQ.java
Normal file
115
.config/Code/User/History/-54951e98/RSMQ.java
Normal file
|
@ -0,0 +1,115 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.animation.PauseTransition;
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Duration;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.sendWarmupRequest();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = SceneCreator.createLoginScene();
|
||||
registerScene = SceneCreator.createRegisterScene();
|
||||
mainScene = SceneCreator.createMainScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
stage.setScene(mainScene);
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
PauseTransition pt = new PauseTransition(Duration.seconds(1));
|
||||
pt.setOnFinished(e -> stage.setScene(loginScene));
|
||||
pt.play();
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private static void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
213
.config/Code/User/History/-54951e98/TClE.java
Normal file
213
.config/Code/User/History/-54951e98/TClE.java
Normal file
|
@ -0,0 +1,213 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
username.setStyle("");
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
188
.config/Code/User/History/-54951e98/WIeo.java
Normal file
188
.config/Code/User/History/-54951e98/WIeo.java
Normal file
|
@ -0,0 +1,188 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setText("user not registered");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
info.setText("success");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setText("incorrect password");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
System.out.println("passwords not match");
|
||||
break;
|
||||
case 1: System.out.println("login success");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
197
.config/Code/User/History/-54951e98/Y3Nn.java
Normal file
197
.config/Code/User/History/-54951e98/Y3Nn.java
Normal file
|
@ -0,0 +1,197 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
201
.config/Code/User/History/-54951e98/ZGYG.java
Normal file
201
.config/Code/User/History/-54951e98/ZGYG.java
Normal file
|
@ -0,0 +1,201 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
187
.config/Code/User/History/-54951e98/a9wZ.java
Normal file
187
.config/Code/User/History/-54951e98/a9wZ.java
Normal file
|
@ -0,0 +1,187 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setText("user not registered");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setText("incorrect password");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0:
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
System.out.println("passwords not match");
|
||||
break;
|
||||
case 1: System.out.println("login success");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
216
.config/Code/User/History/-54951e98/b7gd.java
Normal file
216
.config/Code/User/History/-54951e98/b7gd.java
Normal file
|
@ -0,0 +1,216 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
107
.config/Code/User/History/-54951e98/cob8.java
Normal file
107
.config/Code/User/History/-54951e98/cob8.java
Normal file
|
@ -0,0 +1,107 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = SceneCreator.createLoginScene();
|
||||
registerScene = SceneCreator.createRegisterScene();
|
||||
mainScene = SceneCreator.createMainScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private static void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
206
.config/Code/User/History/-54951e98/dYLo.java
Normal file
206
.config/Code/User/History/-54951e98/dYLo.java
Normal file
|
@ -0,0 +1,206 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
207
.config/Code/User/History/-54951e98/drel.java
Normal file
207
.config/Code/User/History/-54951e98/drel.java
Normal file
|
@ -0,0 +1,207 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
username.setStyle("");
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
107
.config/Code/User/History/-54951e98/eIC7.java
Normal file
107
.config/Code/User/History/-54951e98/eIC7.java
Normal file
|
@ -0,0 +1,107 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = SceneCreator.createLoginScene();
|
||||
registerScene = SceneCreator.createRegisterScene();
|
||||
mainScene = SceneCreator.createMainScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private static void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
218
.config/Code/User/History/-54951e98/eSab.java
Normal file
218
.config/Code/User/History/-54951e98/eSab.java
Normal file
|
@ -0,0 +1,218 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
1
.config/Code/User/History/-54951e98/entries.json
Normal file
1
.config/Code/User/History/-54951e98/entries.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":1,"resource":"file:///home/rafayahmad/Stuff/Coding/Java/hcloudclient/src/main/java/com/rutils/HClient.java","entries":[{"id":"a9wZ.java","timestamp":1720863722014},{"id":"hP5E.java","timestamp":1720863743844},{"id":"WIeo.java","timestamp":1720864061512},{"id":"r3ex.java","timestamp":1720864074832},{"id":"Gtcq.java","timestamp":1720864142155},{"id":"z5iw.java","timestamp":1720864199345},{"id":"QyF5.java","timestamp":1720864224778},{"id":"j75F.java","timestamp":1720864253168},{"id":"LQl0.java","timestamp":1720864266171},{"id":"0ECX.java","timestamp":1720864299111},{"id":"Y3Nn.java","timestamp":1720864317631},{"id":"qKhU.java","timestamp":1720864583046},{"id":"6yUP.java","timestamp":1720864605179},{"id":"ZGYG.java","timestamp":1720864619696},{"id":"vFBu.java","timestamp":1720864728471},{"id":"EgRE.java","timestamp":1720864746778},{"id":"dYLo.java","timestamp":1720864802464},{"id":"Jxcl.java","timestamp":1720864819690},{"id":"7HYU.java","timestamp":1720864892748},{"id":"drel.java","timestamp":1720864922212},{"id":"PUil.java","timestamp":1720931782563},{"id":"vItQ.java","timestamp":1720934111213},{"id":"q0GS.java","timestamp":1720935637554},{"id":"rKb0.java","timestamp":1721116954065},{"id":"KxLu.java","timestamp":1721120871291},{"id":"TClE.java","timestamp":1721202898284},{"id":"rjB3.java","timestamp":1721202923752},{"id":"3AN6.java","timestamp":1721202951322},{"id":"gIRm.java","timestamp":1721202969648},{"id":"DX1l.java","timestamp":1721202999912},{"id":"LYzI.java","timestamp":1721203019708},{"id":"b7gd.java","timestamp":1721203337938},{"id":"1PKj.java","timestamp":1721204152976},{"id":"eSab.java","timestamp":1721204224625},{"id":"hUdd.java","timestamp":1721206336186},{"id":"5mK6.java","timestamp":1721206435909},{"id":"oYkT.java","source":"Organize imports","timestamp":1721297667475},{"id":"DpGy.java","timestamp":1721297708182},{"id":"Anjw.java","timestamp":1721298573995},{"id":"3Uer.java","timestamp":1721387159582},{"id":"DU1B.java","timestamp":1721387192464},{"id":"gj8d.java","source":"Remove all unused imports","timestamp":1721387202651},{"id":"yRx3.java","timestamp":1721387216342},{"id":"GN0U.java","timestamp":1721387272178},{"id":"cob8.java","timestamp":1721387367522},{"id":"eIC7.java","timestamp":1721387381046},{"id":"CoiS.java","timestamp":1721387417970},{"id":"mo0X.java","timestamp":1721387431635},{"id":"OyCc.java","timestamp":1721387644808},{"id":"RSMQ.java","timestamp":1721388065379}]}
|
214
.config/Code/User/History/-54951e98/gIRm.java
Normal file
214
.config/Code/User/History/-54951e98/gIRm.java
Normal file
|
@ -0,0 +1,214 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
username.setStyle("");
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
106
.config/Code/User/History/-54951e98/gj8d.java
Normal file
106
.config/Code/User/History/-54951e98/gj8d.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = SceneCreator.createLoginScene();
|
||||
registerScene = SceneCreator.createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
188
.config/Code/User/History/-54951e98/hP5E.java
Normal file
188
.config/Code/User/History/-54951e98/hP5E.java
Normal file
|
@ -0,0 +1,188 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setText("user not registered");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
info.setText("success");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setText("incorrect password");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0:
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
System.out.println("passwords not match");
|
||||
break;
|
||||
case 1: System.out.println("login success");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
217
.config/Code/User/History/-54951e98/hUdd.java
Normal file
217
.config/Code/User/History/-54951e98/hUdd.java
Normal file
|
@ -0,0 +1,217 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
192
.config/Code/User/History/-54951e98/j75F.java
Normal file
192
.config/Code/User/History/-54951e98/j75F.java
Normal file
|
@ -0,0 +1,192 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setText("user not registered");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
info.setText("success");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setText("incorrect password");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
109
.config/Code/User/History/-54951e98/mo0X.java
Normal file
109
.config/Code/User/History/-54951e98/mo0X.java
Normal file
|
@ -0,0 +1,109 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = SceneCreator.createLoginScene();
|
||||
registerScene = SceneCreator.createRegisterScene();
|
||||
mainScene = SceneCreator.createMainScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public static void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
stage.setScene(mainScene);
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
stage.setScene(loginScene);
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private static void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
218
.config/Code/User/History/-54951e98/oYkT.java
Normal file
218
.config/Code/User/History/-54951e98/oYkT.java
Normal file
|
@ -0,0 +1,218 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
private void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
208
.config/Code/User/History/-54951e98/q0GS.java
Normal file
208
.config/Code/User/History/-54951e98/q0GS.java
Normal file
|
@ -0,0 +1,208 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
username.setStyle("");
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
198
.config/Code/User/History/-54951e98/qKhU.java
Normal file
198
.config/Code/User/History/-54951e98/qKhU.java
Normal file
|
@ -0,0 +1,198 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
187
.config/Code/User/History/-54951e98/r3ex.java
Normal file
187
.config/Code/User/History/-54951e98/r3ex.java
Normal file
|
@ -0,0 +1,187 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setText("user not registered");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
info.setText("success");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setText("incorrect password");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
208
.config/Code/User/History/-54951e98/rKb0.java
Normal file
208
.config/Code/User/History/-54951e98/rKb0.java
Normal file
|
@ -0,0 +1,208 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
username.setStyle("");
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
215
.config/Code/User/History/-54951e98/rjB3.java
Normal file
215
.config/Code/User/History/-54951e98/rjB3.java
Normal file
|
@ -0,0 +1,215 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
username.setStyle("");
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
203
.config/Code/User/History/-54951e98/vFBu.java
Normal file
203
.config/Code/User/History/-54951e98/vFBu.java
Normal file
|
@ -0,0 +1,203 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
208
.config/Code/User/History/-54951e98/vItQ.java
Normal file
208
.config/Code/User/History/-54951e98/vItQ.java
Normal file
|
@ -0,0 +1,208 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
// HttpsUtil.init();
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setStyle("");
|
||||
password.setStyle("");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
username.setStyle("");
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
106
.config/Code/User/History/-54951e98/yRx3.java
Normal file
106
.config/Code/User/History/-54951e98/yRx3.java
Normal file
|
@ -0,0 +1,106 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = SceneCreator.createLoginScene();
|
||||
registerScene = SceneCreator.createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
resetStyles(username, password, info);
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
info.setText("user not registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
username.setStyle("");
|
||||
password.setStyle("");
|
||||
info.setStyle("");
|
||||
info.setText("success");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
username.setStyle("");
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
info.setStyle("");
|
||||
info.setText("incorrect password");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
resetStyles(username, password, passwordAgain, info);
|
||||
System.out.println(status);
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
info.setStyle("-fx-text-fill: green;");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
break;
|
||||
case 2:
|
||||
// user already exists
|
||||
info.setText("user already registered");
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
username.setStyle("-fx-border-color: red;");
|
||||
}
|
||||
}
|
||||
|
||||
private void resetStyles(Node... nodes){
|
||||
for(Node node : nodes){
|
||||
node.setStyle(null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
191
.config/Code/User/History/-54951e98/z5iw.java
Normal file
191
.config/Code/User/History/-54951e98/z5iw.java
Normal file
|
@ -0,0 +1,191 @@
|
|||
package com.rutils;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.MalformedURLException;
|
||||
import javafx.application.Application;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.PasswordField;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class HClient extends Application{
|
||||
|
||||
static Stage stage;
|
||||
|
||||
static Scene loginScene;
|
||||
static Scene registerScene;
|
||||
static Scene mainScene;
|
||||
|
||||
public static void main(String[] args){
|
||||
launch(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(Stage arg1){
|
||||
|
||||
stage = new Stage();
|
||||
stage.setMinWidth(800);
|
||||
stage.setMinHeight(750);
|
||||
|
||||
loginScene = createLoginScene();
|
||||
registerScene = createRegisterScene();
|
||||
|
||||
try{
|
||||
File style = new File("src/main/java/com/rutils/styles/darktheme.css");
|
||||
loginScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
registerScene.getStylesheets().add(style.toURI().toURL().toExternalForm());
|
||||
}
|
||||
catch(MalformedURLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
stage.setScene(loginScene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void handleLogin(TextField username, PasswordField password, Label info){
|
||||
int verified = HttpsUtil.verifyCredentials(username.getText(), password.getText());
|
||||
switch(verified){
|
||||
case 0: // user not registered
|
||||
info.setText("user not registered");
|
||||
break;
|
||||
case 1: // succesful verification
|
||||
info.setText("success");
|
||||
break;
|
||||
case 2: // incorrect passwd
|
||||
info.setText("incorrect password");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void handleRegister(TextField username, PasswordField password, PasswordField passwordAgain, Label info){
|
||||
int status = HttpsUtil.registerUser(username.getText(), password.getText(), passwordAgain.getText());
|
||||
switch(status){
|
||||
case 0: // password not match
|
||||
password.setStyle("-fx-border-color: red;");
|
||||
passwordAgain.setStyle("-fx-border-color: red;");
|
||||
info.setText("passwords do not match");
|
||||
break;
|
||||
case 1: // registered succesfully
|
||||
info.setText("registered successfully");
|
||||
password.setStyle("-fx-border-color: #222222;");
|
||||
passwordAgain.setStyle("-fx-border-color: #222222;");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Scene createLoginScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Login");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
|
||||
Button login = new Button("Login");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> handleLogin(username, password, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> stage.setScene(registerScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, info, login, or, signup);
|
||||
return scene;
|
||||
}
|
||||
|
||||
private Scene createRegisterScene(){
|
||||
VBox root = new VBox();
|
||||
Scene scene = new Scene(root);
|
||||
|
||||
root.requestFocus();
|
||||
root.setAlignment(Pos.CENTER);
|
||||
root.setSpacing(25);
|
||||
root.minWidthProperty().bind(stage.widthProperty());
|
||||
root.minHeightProperty().bind(stage.heightProperty());
|
||||
|
||||
Label label = new Label("Sign Up");
|
||||
label.setFont(new Font(40));
|
||||
|
||||
Region spcr1 = new Region();
|
||||
spcr1.setPrefHeight(20);
|
||||
|
||||
TextField username = new TextField();
|
||||
username.setPromptText("username");
|
||||
username.setFont(new Font(20));
|
||||
username.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
username.setPrefHeight(50);
|
||||
|
||||
PasswordField password = new PasswordField();
|
||||
password.setPromptText("password");
|
||||
password.setFont(new Font(20));
|
||||
password.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
password.setPrefHeight(50);
|
||||
|
||||
PasswordField passwordAgain = new PasswordField();
|
||||
passwordAgain.setPromptText("confirm password");
|
||||
passwordAgain.setFont(new Font(20));
|
||||
passwordAgain.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
passwordAgain.setPrefHeight(50);
|
||||
|
||||
Label info = new Label();
|
||||
info.setPrefHeight(20);
|
||||
info.setStyle("-fx-text-fill: red;");
|
||||
|
||||
Button signup = new Button("Sign Up");
|
||||
signup.setFont(new Font(20));
|
||||
signup.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
signup.setPrefHeight(50);
|
||||
signup.setOnAction(e -> handleRegister(username, password, passwordAgain, info));
|
||||
|
||||
Label or = new Label("OR");
|
||||
or.setFont(new Font(30));
|
||||
|
||||
Button login = new Button("Login Instead");
|
||||
login.setFont(new Font(20));
|
||||
login.maxWidthProperty().bind(scene.widthProperty().divide(3));
|
||||
login.setPrefHeight(50);
|
||||
login.setOnAction(e -> stage.setScene(loginScene));
|
||||
|
||||
root.getChildren().addAll(label, spcr1, username, password, passwordAgain, info, signup, or, login);
|
||||
return scene;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue