Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function registerValidation(username, password, passwordConfirm, email)
- if not username or username == "" or not password or password == "" or not passwordConfirm or passwordConfirm == "" or not email or email == "" then
- guiSetText(lbl_reg_top_info, "Необходимо указать все поля.")
- guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
- playSoundFrontEnd ( 4 )
- elseif string.len(username) < 3 then
- guiSetText(lbl_reg_top_info, "Ваш логин должен имеет менее 3х символов.")
- guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
- playSoundFrontEnd ( 4 )
- elseif string.len(username) >= 15 then
- guiSetText(lbl_reg_top_info, "Ваш логин должен имеет более 20 символов.")
- guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
- playSoundFrontEnd ( 4 )
- elseif string.find(password, "'") or string.find(password, '"') then
- guiSetText(lbl_reg_top_info, "Пароль не совпадает ' or "..'"')
- guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
- playSoundFrontEnd ( 4 )
- elseif string.len(password) < 6 then
- guiSetText(lbl_reg_top_info, "Пароль должен иметь более 6 символов")
- guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
- playSoundFrontEnd ( 4 )
- elseif password ~= passwordConfirm then
- guiSetText(lbl_reg_top_info, "Пароли не совпадают")
- guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
- playSoundFrontEnd ( 4 )
- elseif string.match(username,"%W") then
- guiSetText(lbl_reg_top_info, "В логине разрешены только буквы и цифры.")
- guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
- playSoundFrontEnd ( 4 )
- else
- local validEmail, reason = exports.global:isEmail(email)
- if not validEmail then
- guiSetText(lbl_reg_top_info, reason)
- guiLabelSetColor ( lbl_reg_top_info, 255, 0, 0 )
- playSoundFrontEnd ( 4 )
- else
- triggerServerEvent("accounts:register:attempt",getLocalPlayer(),username,password,passwordConfirm, email)
- authen_msg("Register", "Sending request to server.")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement