Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Email passwordless connection (send code only) #169

Merged
merged 10 commits into from
Sep 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
reference: http://www.objc.io/issue-6/travis-ci.html

language: objective-c
osx_image: xcode6.4
osx_image: xcode7

install:
- bundle install
Expand Down
10 changes: 10 additions & 0 deletions Lock.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ Auth0 is a SaaS that helps you with Authentication and Authorization. You can us
sms.resource_bundles = { 'Auth0.SMS' => ['Pod/Assets/SMS/*.plist', 'Pod/Assets/SMS/Images/*.png'] }
end

s.subspec 'Email' do |email|
email.platform = :ios
email.public_header_files = 'Pod/Classes/Email/*.h'
email.private_header_files = 'Pod/Classes/Email/Private/*.h'
email.source_files = ['Pod/Classes/Email/*.{h,m}', 'Pod/Classes/Email/Private/*.{h,m}']
email.resources = 'Pod/Assets/Email/*.xib'
email.dependency 'Lock/UI'
email.resource_bundles = { 'Auth0.Email' => ['Pod/Assets/Email/*.plist', 'Pod/Assets/Email/Images/*.png'] }
end

s.subspec '1Password' do |onepassword|
onepassword.platform = :ios
onepassword.public_header_files = 'Pod/Classes/1Password/*.h'
Expand Down
104 changes: 52 additions & 52 deletions Lock/Lock.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Lock/Lock/A0HomeViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@
- (IBAction)loginNative:(id)sender;
- (IBAction)loginTouchID:(id)sender;
- (IBAction)loginSMS:(id)sender;
- (IBAction)loginEmail:(id)sender;

@end
26 changes: 20 additions & 6 deletions Lock/Lock/A0HomeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
#import <ReactiveCocoa/ReactiveCocoa.h>
#import "A0LockApplication.h"

#if __has_include(<TouchIDAuth/A0TouchIDAuthentication.h>)
#define TOUCH_ID 1
#endif

#define kClientIdKey @"Auth0ClientId"
#define kTenantKey @"Auth0Tenant"

Expand Down Expand Up @@ -105,7 +101,6 @@ - (void)loginNative:(id)sender {

- (void)loginTouchID:(id)sender {
[self.keychain clearAll];
#ifdef TOUCHID
A0Lock *lock = [[A0LockApplication sharedInstance] lock];

A0TouchIDLockViewController *controller = [lock newTouchIDViewController];
Expand All @@ -122,7 +117,6 @@ - (void)loginTouchID:(id)sender {
}];
};
[lock presentTouchIDController:controller fromController:self];
#endif
}

- (void)loginSMS:(id)sender {
Expand All @@ -143,4 +137,24 @@ - (void)loginSMS:(id)sender {
};
[lock presentSMSController:controller fromController:self];
}

- (void)loginEmail:(id)sender {
[self.keychain clearAll];
A0Lock *lock = [[A0LockApplication sharedInstance] lock];
A0EmailLockViewController *controller = [lock newEmailViewController];
controller.closable = YES;
@weakify(self);
controller.onAuthenticationBlock = ^(A0UserProfile *profile, A0Token *token) {
NSLog(@"SUCCESS %@", profile);
@strongify(self);
[self.keychain setString:token.idToken forKey:@"id_token"];
[self.keychain setString:token.refreshToken forKey:@"refresh_token"];
[self.keychain setData:[NSKeyedArchiver archivedDataWithRootObject:profile] forKey:@"profile"];
[self dismissViewControllerAnimated:YES completion:^(){
[self performSegueWithIdentifier:@"LoggedIn" sender:self];
}];
};
[lock presentEmailController:controller fromController:self];
}

@end
250 changes: 93 additions & 157 deletions Lock/Lock/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions Lock/Lock/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,22 @@
"filename" : "iPhone 6,5,4 @2x -58-1.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "iPhone 6,5,4 @2x -80.png",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
Expand Down
27 changes: 27 additions & 0 deletions Lock/Lock/Lock-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,32 @@
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
</dict>
</plist>
4 changes: 2 additions & 2 deletions Lock/Podfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '7.0'
platform :ios, '9.0'

def pod_with_warnings
pod 'libextobjc', :inhibit_warnings => true #Ignore warnings for this lib
Expand All @@ -9,7 +9,7 @@ def pod_with_warnings
end

target 'Lock', :exclusive => true do
pod 'Lock', :path => '../', :subspecs => ['SMS', 'ReactiveCore', '1Password', 'Safari', 'WebView', 'TouchID']
pod 'Lock', :path => '../', :subspecs => ['ReactiveCore', '1Password', 'Safari', 'WebView', 'TouchID', 'Email', 'SMS']
pod 'Lock-Facebook', '~> 2.0'
pod 'Lock-Twitter', '~> 1.0'

Expand Down
7 changes: 6 additions & 1 deletion Lock/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ PODS:
- CocoaLumberjack (~> 2.0)
- libextobjc (~> 0.4)
- Lock/Core
- Lock/Email (1.18.0):
- CocoaLumberjack (~> 2.0)
- libextobjc (~> 0.4)
- Lock/UI
- Lock/ReactiveCore (1.18.0):
- CocoaLumberjack (~> 2.0)
- libextobjc (~> 0.4)
Expand Down Expand Up @@ -199,6 +203,7 @@ DEPENDENCIES:
- Lock-Facebook (~> 2.0)
- Lock-Twitter (~> 1.0)
- Lock/1Password (from `../`)
- Lock/Email (from `../`)
- Lock/ReactiveCore (from `../`)
- Lock/Safari (from `../`)
- Lock/SMS (from `../`)
Expand Down Expand Up @@ -229,7 +234,7 @@ SPEC CHECKSUMS:
ISO8601DateFormatter: ab926648eebe497f4d167c0fd083992f959f1274
JWTDecode: c193d229af74dd72121515c976f930ccbed96a2a
libextobjc: a650fc1bf489a3d3a9bc2e621efa3e1006fc5471
Lock: 74df3917e300de2d2accddf4d8dfcc1c72e683cf
Lock: 9a2cdd8f3878c98bee4379fc47cff56f4b7a89ed
Lock-Facebook: 36e982eb8221dd07fcc9770781e3fc6363be28d3
Lock-Twitter: 8168e4c3861f6cc6581d1b8d635f41e29a607cb3
LUKeychainAccess: 6479edb12cf06e11ff3336f796959eedbc58f714
Expand Down
122 changes: 122 additions & 0 deletions Pod/Assets/Email/A0EmailCodeViewController.xib
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="8191" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8154"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="A0SMSCodeViewController">
<connections>
<outlet property="codeFieldView" destination="esC-bu-ZPY" id="zIU-zE-8DU"/>
<outlet property="loginButton" destination="GlB-fC-sye" id="2B7-ev-g6d"/>
<outlet property="messageLabel" destination="d04-XJ-9xx" id="uaV-Jz-3uS"/>
<outlet property="view" destination="yrE-uH-HKO" id="ZQj-Ua-8fZ"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="yrE-uH-HKO">
<rect key="frame" x="0.0" y="0.0" width="600" height="192"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" horizontalCompressionResistancePriority="1000" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="GlB-fC-sye" customClass="A0ProgressButton">
<rect key="frame" x="21" y="137" width="558" height="55"/>
<constraints>
<constraint firstAttribute="height" constant="55" id="FFY-LI-TVR"/>
</constraints>
<fontDescription key="fontDescription" name="HelveticaNeue-Medium" family="Helvetica Neue" pointSize="13"/>
<state key="normal" title="LOGIN">
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
</state>
<state key="disabled" title=" "/>
<connections>
<action selector="login:" destination="-1" eventType="touchUpInside" id="Dtg-iW-2iu"/>
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5ub-pd-xuL" customClass="A0RoundedBoxView">
<rect key="frame" x="21" y="69" width="558" height="50"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="esC-bu-ZPY" customClass="A0CredentialFieldView">
<rect key="frame" x="0.0" y="0.0" width="558" height="50"/>
<subviews>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="SMS Code" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="O1y-8u-u3e">
<rect key="frame" x="44" y="10" width="507" height="30"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" keyboardType="numberPad" returnKeyType="send"/>
<connections>
<action selector="login:" destination="-1" eventType="editingDidEndOnExit" id="I3N-VE-LS3"/>
</connections>
</textField>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="Auth0.bundle/lock" translatesAutoresizingMaskIntoConstraints="NO" id="Ohf-Uq-zFi">
<rect key="frame" x="18" y="17" width="16" height="16"/>
<color key="tintColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
</imageView>
</subviews>
<constraints>
<constraint firstItem="Ohf-Uq-zFi" firstAttribute="centerY" secondItem="O1y-8u-u3e" secondAttribute="centerY" id="5kD-ZP-3jC"/>
<constraint firstItem="Ohf-Uq-zFi" firstAttribute="leading" secondItem="esC-bu-ZPY" secondAttribute="leading" constant="18" id="DIa-lB-ifn"/>
<constraint firstAttribute="bottom" secondItem="O1y-8u-u3e" secondAttribute="bottom" constant="10" id="ZqN-fl-vDI"/>
<constraint firstItem="O1y-8u-u3e" firstAttribute="top" secondItem="esC-bu-ZPY" secondAttribute="top" constant="10" id="hsj-Ty-myk"/>
<constraint firstAttribute="trailing" secondItem="O1y-8u-u3e" secondAttribute="trailing" constant="7" id="hx6-Ai-lmo"/>
<constraint firstAttribute="height" constant="50" id="sC6-uu-EPl"/>
<constraint firstItem="O1y-8u-u3e" firstAttribute="leading" secondItem="Ohf-Uq-zFi" secondAttribute="trailing" constant="10" id="x8l-My-6u4"/>
</constraints>
<connections>
<outlet property="iconImageView" destination="Ohf-Uq-zFi" id="5IT-4x-NhU"/>
<outlet property="textField" destination="O1y-8u-u3e" id="QPF-vl-oxH"/>
</connections>
</view>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="esC-bu-ZPY" secondAttribute="trailing" id="5bu-kN-zp4"/>
<constraint firstItem="esC-bu-ZPY" firstAttribute="leading" secondItem="5ub-pd-xuL" secondAttribute="leading" id="7am-lk-nZd"/>
<constraint firstItem="esC-bu-ZPY" firstAttribute="top" secondItem="5ub-pd-xuL" secondAttribute="top" id="86t-yZ-Fi4"/>
<constraint firstAttribute="height" constant="50" id="Nqj-pi-9yx"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="1000" verticalHuggingPriority="251" horizontalCompressionResistancePriority="1000" usesAttributedText="YES" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" preferredMaxLayoutWidth="298" translatesAutoresizingMaskIntoConstraints="NO" id="d04-XJ-9xx">
<rect key="frame" x="167" y="10" width="267" height="51"/>
<attributedString key="attributedText">
<fragment content="Please check your phone ">
<attributes>
<color key="NSColor" red="0.29803921570000003" green="0.29803921570000003" blue="0.29803921570000003" alpha="1" colorSpace="calibratedRGB"/>
<font key="NSFont" size="13" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
<fragment content="+5491156815123">
<attributes>
<color key="NSColor" red="0.29803921570000003" green="0.29803921570000003" blue="0.29803921570000003" alpha="1" colorSpace="calibratedRGB"/>
<font key="NSFont" size="13" name="HelveticaNeue-Bold"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
<fragment content=". You’ve received a message from us with your passcode">
<attributes>
<color key="NSColor" red="0.29803921570000003" green="0.29803921570000003" blue="0.29803921570000003" alpha="1" colorSpace="calibratedRGB"/>
<font key="NSFont" size="13" name="HelveticaNeue"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="5ub-pd-xuL" secondAttribute="trailing" constant="21" id="0je-RV-V0Y"/>
<constraint firstAttribute="centerX" secondItem="d04-XJ-9xx" secondAttribute="centerX" id="7Bt-K1-d9o"/>
<constraint firstItem="GlB-fC-sye" firstAttribute="leading" secondItem="yrE-uH-HKO" secondAttribute="leading" constant="21" id="9NW-7l-udI"/>
<constraint firstItem="GlB-fC-sye" firstAttribute="top" secondItem="5ub-pd-xuL" secondAttribute="bottom" constant="18" id="C3V-hm-21p"/>
<constraint firstItem="5ub-pd-xuL" firstAttribute="leading" secondItem="yrE-uH-HKO" secondAttribute="leading" constant="21" id="fkV-ys-jHq"/>
<constraint firstItem="5ub-pd-xuL" firstAttribute="top" secondItem="d04-XJ-9xx" secondAttribute="bottom" constant="8" id="iKM-qm-ey8"/>
<constraint firstItem="d04-XJ-9xx" firstAttribute="top" secondItem="yrE-uH-HKO" secondAttribute="top" constant="10" id="lHf-f1-BYZ"/>
<constraint firstAttribute="trailing" secondItem="GlB-fC-sye" secondAttribute="trailing" constant="21" id="oaZ-Fv-zFo"/>
<constraint firstAttribute="bottom" secondItem="GlB-fC-sye" secondAttribute="bottom" id="te5-5R-GZs"/>
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<point key="canvasLocation" x="349" y="202"/>
</view>
</objects>
<resources>
<image name="Auth0.bundle/lock" width="16" height="16"/>
</resources>
</document>
Loading