首页 > 代码库 > ios-密码判断
ios-密码判断
我们经常在项目时有涉及到用户或是手机号登录,这时一般会配合密码才能登录成功。
下面发一些关于手机和密码形式的判断:
1 - (void)registButtonClick:(id)sender 2 { 3 if (self.phoneTextField.text.length != 11 )//手机号码判断 4 { 5 if (self.phoneTextField.text.length <= 0) 6 { 7 pushView.hidden = NO; 8 pushView.tiShiLab.text = @"手机号不能为空"; 9 }else10 {11 pushView.hidden = NO;12 pushView.tiShiLab.text = @"请正确输入手机号";13 }14 [self registReturnKeyBoard];15 return;16 }17 if (self.passWordTextField.text.length <= 0)//密码判断18 {19 pushView.hidden = NO;20 pushView.tiShiLab.text = @"密码不能为空,请重新输入~";21 [self registReturnKeyBoard]; 22 return;23 }24 if (self.passWordTextField.text.length < 6)//密码判断25 {26 pushView.hidden = NO;27 pushView.tiShiLab.text = @"密码不能少于6位数,请重新输入~";28 [self registReturnKeyBoard];29 return;30 }31 NSString *url;32 if (self.passWordTextField.text)33 {34 url = [GetData getRegistWithMobile:self.phoneTextField.text andPassWord:[MyMD5 md5:self.passWordTextField.text]];//===吴61135 }else36 {37 pushView.hidden = NO;38 pushView.tiShiLab.text = @"密码不能为空";39 [self registReturnKeyBoard];40 return;41 }42 [self registReturnKeyBoard];43 GetData *gd = [[GetData alloc]init];44 gd.urlTag = 1;45 gd.datadele = self;46 [gd getDataWithUrlTest:url];47 }
- (void)registButtonClick:(id)sender
{
if (self.phoneTextField.text.length != 11 )//手机号码判断
{
if (self.phoneTextField.text.length <= 0)
{
pushView.hidden = NO;
pushView.tiShiLab.text = @"手机号不能为空";
}else
{
pushView.hidden = NO;
pushView.tiShiLab.text = @"请正确输入手机号";
}
[self registReturnKeyBoard];
return;
}
if (self.passWordTextField.text.length <= 0)//密码判断
{
pushView.hidden = NO;
pushView.tiShiLab.text = @"密码不能为空,请重新输入~";
[self registReturnKeyBoard];
return;
}
if (self.passWordTextField.text.length < 6)//密码判断
{
pushView.hidden = NO;
pushView.tiShiLab.text = @"密码不能少于6位数,请重新输入~";
[self registReturnKeyBoard];
return;
}
NSString *url;
if (self.passWordTextField.text)
{
url = [GetData getRegistWithMobile:self.phoneTextField.text andPassWord:[MyMD5 md5:self.passWordTextField.text]];//===吴611
}else
{
pushView.hidden = NO;
pushView.tiShiLab.text = @"密码不能为空";
[self registReturnKeyBoard];
return;
}
[self registReturnKeyBoard];
GetData *gd = [[GetData alloc]init];
gd.urlTag = 1;
gd.datadele = self;
[gd getDataWithUrlTest:url];
}
ios-密码判断