C
C
CodeInside2015-04-20 01:05:36
Algorithms
CodeInside, 2015-04-20 01:05:36

How to activate an account?

I register in this way:
1) the user sends his data to the server (including soap)
2) this data is written to the reg table (a list of accounts that have not yet been verified)
3) the account activation code is sent to the soap and the user is redirected to the code entry page
Here I think what to do if there are a lot of lines in the reg table with the same mail. Take the last entry and check only it? If so, is it possible to somehow do a mysql search for a string from the end? Or is it better to remember its id when adding a row to the table, and then transfer it until the code (mail) is checked?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vitaly Pukhov, 2015-04-20
@Neuroware

in theory, you need to enter the code in a separate field in the table and search only by the code, in this case it does not matter how many e-mails there are, but the presence of e-mail must be checked during registration, in the table where the list of verified accounts is stored, although I don’t see much point in dividing it into 2 tables because of 1 flag.

X
xmoonlight, 2015-04-20
@xmoonlight

Confirm mail through the mailbox check link:
until the link is clicked (from the letter) - do not add an entry to the table.

D
Dmitry Entelis, 2015-04-20
@DmitriyEntelis

where `email`="[email protected]" and `code`="qwerty"
obviously.
It’s quite good not to litter the email table, put the code in a separate one.
There should not be a bunch of lines with the same email, because the email field without options is unique.
PS In general, think about how realistic all these confirmations are. 21st century in the yard.

E
Evgeny Bukharev, 2015-04-20
@evgenybuckharev

Initially, the approach is not correct.
The user submits the form, the data is written, let’s say, to the users table, the list of accounts that have not yet been verified, etc. is superfluous, we add a field with the activation status to the entry in the table with users, by default it is 0, upon successful activation 1,
well, we check during registration on the uniqueness of email in the table

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question