'I wanted to make simple register/login, but whenever I type login and password it writes "successfully loged inn", even if it is not right

import 'dart:io';

void main() {
  Register register = Register();
  register.registration();
  Login login = Login();
  login.loginAcc();
}

class Register {
  String? name;
  String? email;
  var password;
  registration() {
    print("Let's make a registration");
    print("Please, enter your name");
    name = stdin.readLineSync();
    print("Enter your email");
    email = stdin.readLineSync();
    print("Enter your password");
    password = stdin.readLineSync();
  }
}

class Login {
  String? emailLogin;
  var passwordLogin;
  loginAcc() {
    print("Log In. Enter your email");
    emailLogin = stdin.readLineSync();
    print("Enter your password");
    passwordLogin = stdin.readLineSync();
    if (Login().emailLogin == Register().email &&
        Login().passwordLogin == Register().password) {
      print("successfully logged inn.");
    } else {
      print("Something is wrong. Try again!");
    }
  }
}

I wanted to make simple register/login, but whenever I type login and password it writes "successfully logged inn", even if it is not right. What s wrong with it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source