add change password
This commit is contained in:
parent
5f3e35ae00
commit
a8e0aff851
@ -12,6 +12,9 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.AppMobile"
|
||||
tools:targetApi="31">
|
||||
<activity
|
||||
android:name=".ForgotPasswordActivity"
|
||||
android:exported="false" />
|
||||
<activity
|
||||
android:name=".TicksActivity"
|
||||
android:exported="false" />
|
||||
|
@ -0,0 +1,66 @@
|
||||
package com.example.appmobile;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.appmobile.models.User;
|
||||
|
||||
public class ForgotPasswordActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_forgot_password);
|
||||
}
|
||||
|
||||
public void onCancel(View v){
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
public void onSave(View v){
|
||||
TextView email = findViewById(R.id.inputEmail);
|
||||
TextView password = findViewById(R.id.inputNewPass);
|
||||
TextView password2 = findViewById(R.id.inputConfNewPass);
|
||||
|
||||
if(!email.getText().toString().equals(User.email)){
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("ERROR!!")
|
||||
.setMessage("Неверная почта")
|
||||
.setCancelable(true)
|
||||
.setPositiveButton("Ok", (dialog, which) -> {
|
||||
dialog.cancel();
|
||||
});
|
||||
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!password.getText().toString().equals(password2.getText().toString())){
|
||||
//Toast.makeText(this, "Пароли не одинаковые", Toast.LENGTH_LONG).show();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("ERROR!!")
|
||||
.setMessage("Пароли не совпадают")
|
||||
.setCancelable(true)
|
||||
.setPositiveButton("Ok", (dialog, which) -> {
|
||||
dialog.cancel();
|
||||
});
|
||||
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
return;
|
||||
}
|
||||
|
||||
User.email = email.getText().toString();
|
||||
User.password = password.getText().toString();
|
||||
|
||||
Intent intent = new Intent(this, MainActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
@ -45,4 +45,9 @@ public class MainActivity extends AppCompatActivity {
|
||||
Intent intent = new Intent(this, RegistrationActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
public void toChangePassword(View v){
|
||||
Intent intent = new Intent(this, ForgotPasswordActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
}
|
@ -34,7 +34,7 @@ public class RegistrationActivity extends AppCompatActivity {
|
||||
//Toast.makeText(this, "Пароли не одинаковые", Toast.LENGTH_LONG).show();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||
builder.setTitle("ERROR!!")
|
||||
.setMessage("Пароли не одинаковые")
|
||||
.setMessage("Пароли не совпадают")
|
||||
.setCancelable(true)
|
||||
.setPositiveButton("Ok", (dialog, which) -> {
|
||||
dialog.cancel();
|
||||
|
@ -15,6 +15,10 @@ public class TasksActivity extends AppCompatActivity {
|
||||
private Button btn_open, btn_closed;
|
||||
private FrameLayout navBarFrameLayout;
|
||||
|
||||
private String[] open = new String[]{
|
||||
"",
|
||||
};
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
111
AppMobile/app/src/main/res/layout/activity_forgot_password.xml
Normal file
111
AppMobile/app/src/main/res/layout/activity_forgot_password.xml
Normal file
@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/main_green"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".ForgotPasswordActivity">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/Logo"
|
||||
android:layout_width="380dp"
|
||||
android:layout_height="187dp"
|
||||
android:layout_marginTop="32dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/todoka" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputEmail"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="48dp"
|
||||
android:ems="10"
|
||||
android:hint="@string/reg_email_hint"
|
||||
android:inputType="textEmailAddress"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewEmail" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/viewEmail"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="48dp"
|
||||
android:text="@string/email"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.15"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/Logo" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/viewNewPass"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/new_password"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.176"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/inputEmail" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/viewConfNewPass"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/confirm_new_password"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.212"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/inputNewPass" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputNewPass"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="48dp"
|
||||
android:hint="@string/reg_password_hint"
|
||||
android:ems="10"
|
||||
android:inputType="textPassword"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewNewPass" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/inputConfNewPass"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="48dp"
|
||||
android:ems="10"
|
||||
android:hint="@string/reg_confirm_password_hint"
|
||||
android:inputType="textPassword"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.504"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/viewConfNewPass" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/button2"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="84dp"
|
||||
android:background="@drawable/active_back"
|
||||
android:text="@string/save_changes"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.495"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/inputConfNewPass" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_cancel_reg"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="48dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:onClick="onCancel"
|
||||
android:text="@string/reg_return"
|
||||
android:textColor="@color/black"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/button2" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -41,7 +41,7 @@
|
||||
android:layout_marginTop="112dp"
|
||||
android:onClick="onEnter"
|
||||
android:text="@string/enter"
|
||||
android:backgroundTint="@color/main_pink"
|
||||
android:background="@drawable/active_back"
|
||||
android:textSize="18sp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.504"
|
||||
@ -66,6 +66,7 @@
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="48dp"
|
||||
android:background="@android:color/transparent"
|
||||
android:onClick="toChangePassword"
|
||||
android:text="@string/forgot_password"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp"
|
||||
|
@ -59,7 +59,7 @@
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginBottom="44dp"
|
||||
android:backgroundTint="@color/main_pink"
|
||||
android:background="@drawable/active_back"
|
||||
android:text="@string/del_profile"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/nav_bar_user"
|
||||
|
@ -15,7 +15,7 @@
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/reg_confirm_password"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.219"
|
||||
app:layout_constraintHorizontal_bias="0.18"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/regPassword" />
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
android:hint="@string/reg_name_hint"
|
||||
android:inputType="text"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.495"
|
||||
app:layout_constraintHorizontal_bias="0.477"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/regNameText" />
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
android:hint="@string/reg_email_hint"
|
||||
android:inputType="textEmailAddress"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.495"
|
||||
app:layout_constraintHorizontal_bias="0.477"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/regEmailText" />
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
android:hint="@string/reg_password_hint"
|
||||
android:inputType="textPassword"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.495"
|
||||
app:layout_constraintHorizontal_bias="0.477"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/regPasswordText" />
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
android:hint="@string/reg_confirm_password_hint"
|
||||
android:inputType="textPassword"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.495"
|
||||
app:layout_constraintHorizontal_bias="0.477"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/regConfirmPasswordText" />
|
||||
|
||||
@ -72,7 +72,7 @@
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginTop="48dp"
|
||||
android:backgroundTint="@color/main_pink"
|
||||
android:background="@drawable/active_back"
|
||||
android:onClick="onReg"
|
||||
android:text="@string/reg_button"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
@ -87,7 +87,7 @@
|
||||
android:layout_marginTop="64dp"
|
||||
android:text="@string/reg_name"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.144"
|
||||
app:layout_constraintHorizontal_bias="0.143"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/Logo" />
|
||||
|
||||
@ -96,9 +96,9 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/reg_email"
|
||||
android:text="@string/email"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.197"
|
||||
app:layout_constraintHorizontal_bias="0.142"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/regName" />
|
||||
|
||||
|
@ -12,20 +12,22 @@
|
||||
<string name="sign_up">Sign Up</string>
|
||||
<string name="forgot_password">Forgot my password</string>
|
||||
|
||||
<string name="reg_name">Имя:</string>
|
||||
<string name="reg_name">Name:</string>
|
||||
<string name="reg_name_hint">Тутука</string>
|
||||
|
||||
<string name="reg_email">Электронная почта:</string>
|
||||
<string name="email">Email:</string>
|
||||
<string name="reg_email_hint">totoka@totoka</string>
|
||||
|
||||
<string name="reg_password">Пароль:</string>
|
||||
<string name="new_password">New password:</string>
|
||||
<string name="reg_password">Password:</string>
|
||||
<string name="reg_password_hint">12345</string>
|
||||
|
||||
<string name="reg_confirm_password">Подтверждение пароля:</string>
|
||||
<string name="confirm_new_password">Confirm new password:</string>
|
||||
<string name="reg_confirm_password">Confirm password:</string>
|
||||
<string name="reg_confirm_password_hint">12345</string>
|
||||
|
||||
<string name="reg_button">РЕГИСТРАЦИЯ</string>
|
||||
<string name="reg_return">ОТМЕНА</string>
|
||||
<string name="reg_button">REGISTRATION</string>
|
||||
<string name="reg_return">CANCEL</string>
|
||||
|
||||
<string name="tasks">TASKS</string>
|
||||
<string name="todo">todo</string>
|
||||
@ -44,4 +46,7 @@
|
||||
<string name="arrow_right">arrow_right</string>
|
||||
<string name="arrow_left">arrow_left</string>
|
||||
|
||||
<string name="save_changes">SAVE CHANGES</string>
|
||||
|
||||
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user