All Projects → TimOliver → Topasscodeviewcontroller

TimOliver / Topasscodeviewcontroller

Licence: mit
A modal passcode input and validation view controller for iOS

Projects that are alternatives of or similar to Topasscodeviewcontroller

Realm Loginkit
A generic interface for logging in to Realm Mobile Platform apps
Stars: ✭ 70 (-81.23%)
Mutual labels:  cocoapods, uiviewcontroller
Djsemimodalviewcontroller
Simple semi modal presentation dialog with stacked content
Stars: ✭ 137 (-63.27%)
Mutual labels:  cocoapods, uiviewcontroller
Towebviewcontroller
A view controller class for iOS that allows users to view web pages directly within an app.
Stars: ✭ 1,500 (+302.14%)
Mutual labels:  cocoapods, uiviewcontroller
Smileviewcontroller
UIViewController which allows to detect smile in real time.
Stars: ✭ 189 (-49.33%)
Mutual labels:  cocoapods, uiviewcontroller
Swifty360player
iOS 360-degree video player streaming from an AVPlayer.
Stars: ✭ 118 (-68.36%)
Mutual labels:  cocoapods, uiviewcontroller
Passwordtextfield
A custom TextField with a switchable icon which shows or hides the password and enforce good password policies
Stars: ✭ 281 (-24.66%)
Mutual labels:  cocoapods, password
Pushnotificationmanager
Convenient and comprehensive api for push notification,provide 6 stems and 20 branchs' function,offer examples written by Objective-C and Swift respectively
Stars: ✭ 354 (-5.09%)
Mutual labels:  cocoapods
Gcdobjc
Objective-C wrapper for Grand Central Dispatch
Stars: ✭ 358 (-4.02%)
Mutual labels:  cocoapods
Observable
The easiest way to observe values in Swift.
Stars: ✭ 346 (-7.24%)
Mutual labels:  cocoapods
Pagecontroller
Infinite paging controller, scrolling through contents and title bar scrolls with a delay
Stars: ✭ 344 (-7.77%)
Mutual labels:  cocoapods
Circularprogress
Circular progress indicator for your macOS app
Stars: ✭ 366 (-1.88%)
Mutual labels:  cocoapods
Passmaker
可以自定义规则的密码字典生成器,支持图形界面 A password-generator that base on the rules that you specified
Stars: ✭ 363 (-2.68%)
Mutual labels:  password
Dknightversion
Manage Colors, Integrate Night/Multiple Themes. (Unmaintained)
Stars: ✭ 3,559 (+854.16%)
Mutual labels:  cocoapods
Kaonashi
Wordlist, rules and masks from Kaonashi project (RootedCON 2019)
Stars: ✭ 353 (-5.36%)
Mutual labels:  password
Pick
A secure and easy-to-use CLI password manager for macOS and Linux
Stars: ✭ 359 (-3.75%)
Mutual labels:  password
Duplicut
Remove duplicates from MASSIVE wordlist, without sorting it (for dictionary-based password cracking)
Stars: ✭ 352 (-5.63%)
Mutual labels:  password
Zdstickerview
ZDStickerView is an Objective-C module for iOS and offers complete configurability, including movement, resizing, rotation and more, with one finger.
Stars: ✭ 368 (-1.34%)
Mutual labels:  cocoapods
Ehhorizontalselectionview
Horizontal table view style controller
Stars: ✭ 346 (-7.24%)
Mutual labels:  cocoapods
Ssspinnerbutton
Forget about typical stereotypic loading, It's time to change. SSSpinnerButton is an elegant button with a diffrent spinner animations.
Stars: ✭ 357 (-4.29%)
Mutual labels:  cocoapods
Cocoadebug
iOS Debugging Tool 🚀
Stars: ✭ 3,769 (+910.46%)
Mutual labels:  cocoapods

TOPasscodeViewController

A modal passcode input and validation view controller for iOS.

CI Version GitHub license Platform Beerpay PayPal Twitch

TOPasscodeViewController is an open-source UIViewController subclass that will overlay a full-screen passcode UI over an app's content. The user must enter the correct password into it in order to proceed, or hit 'Cancel' to exit the private part of the app.

This sort of UI is useful for certain apps that contain highly sensitive information (such as banking or health) where users may indeed want an extra level of security beyond the standard iOS passcode.

Features

  • Prompts users to enter a passcode in order to proceed.
  • May be presented as a translucent overlay, partially showing the normal app content behind it.
  • Supports 4 different passcode types, from 4-digit passcodes, up to full alphanumeric passcodes.
  • Supports 4 base themes, including translucent/opaque and light/dark.
  • Supports Touch ID validation.
  • Provides an additional settings view controller for letting users change their passcode.
  • Passcode validation is handled by the parent app through a variety of delegate callbacks.
  • A custom animation and layout when the device is rotated to landscape mode on iPhone.
  • Custom 'opening' and 'dismissal' animations.

System Requirements

iOS 8.3 or above

Installation

As a CocoaPods Dependency

Add the following to your Podfile:

pod 'TOPasscodeViewController'

As a Carthage Dependency

Coming soon. :)

Manual Installation

Download this project from GitHub, move the subfolder named 'TOPasscodeViewController' over to your project folder, and drag it into your Xcode project.

Examples

TOPasscodeViewController operates around a very strict modal implementation. It cannot be pushed to a UINavigationController stack, and must be presented as a full-screen dialog on an existing view controller.

Basic Implementation

- (void)showButtonTapped:(id)sender
{
    TOPasscodeViewController *passcodeViewController = [[TOPasscodeViewController alloc] initWithStyle:TOPasscodeViewStyleTranslucentDark passcodeType:TOPasscodeTypeFourDigits];
    passcodeViewController.delegate = self;
    [self presentViewController:passcodeViewController animated:YES completion:nil];
}

- (void)didTapCancelInPasscodeViewController:(TOPasscodeViewController *)passcodeViewController
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (BOOL)passcodeViewController:(TOPasscodeViewController *)passcodeViewController isCorrectCode:(NSString *)code
{
    return [code isEqualToString:@"1234"];
}

Security

TOPasscodeViewController does not perform any password management on your behalf. Any passcodes the user enters are forwarded to your own code via its delegate, and it's up to you to perform the validation and return the result back to TOPasscodeViewController.

This was an intentional decision for security reasons. Instead of every app using TOPasscodeViewController implementing the exact same validation and storage code path, you're free to custom tailor the way passcodes are handled in your app as you see fit.

No matter which passcode type, all passcodes in TOPasscodeViewController are handled as strings. When storing them in your app, they should be given at least the same level of scrutiny as full passwords. As such, I would strongly recommend you generate a salted hash of any user-defined passcode, and store both the hash and the salt in a protected location, like the iOS secure keychain, or an encrypted Realm file.

Because passcodes are treated as generic strings, if the user has selected a different passcode type (like an arbitrary numerical or alphanumeric one), you should also store that setting alongside the hash as well.

How it works

There's nothing too crazy about how this view controller was created. All reusable components are broken out into separate UIView classes, and an all-encompassing TOPasscodeView class is used to pull as much view logic out of the view controller (one way of solving the Massive View Controller problem.)

Depending on the screen width of the device (or if an iPad is using split screen), a single class manages all of the values for laying out the content with the appropriate font sizes, margins and cIrcle sizes. This was done to ensure maximum granular control over the sizing of elements per device. When transitioning between two of these sizes, all image assets are regenerated to ensure proper pixel scaling.

The view controller heavily uses UIVisualEffectView to produce its translucent effect. When dealing with these, I discovered a few interesting tidbits:

  • For effect views that blur the content behind them, you can animate setting the effect property from nil to a UIBlurEffect object to produce a very nice gradually blurring transition effect.
  • Effect views with a UIVibrancyEffect CANNOT EVER have an alpha value less than 1.0. Trying to animate fading in one of these views will result in an effect that will be broken until the animation has completed. To fix this, I added a contentAlpha property to my subclasses that would manually target the alpha values of all subviews, but would leave the visual effect view itself at 1.0. This created the desired effect where the translucent content would fade in properly.

Is it App Store-safe?

UPDATE: No. In it's current form, it's getting rejected from the App Store. See issue #31.

This is a tricky question. App Review guideline 5.2.5 states that apps can't produce UIs that might be easily confused with system functionality, but this rule is incredibly subjective and will ultimately heavily depend on the app reviewer at the time.

Since the default style and text for this view controller make it very easily confused with the iOS lock screen, I would strongly recommend making these changes before shipping:

  • Set your app icon as the titleView property of TOPasscodeViewController to add more specialised branding to it.
  • Change the default tittle text to be more specific. Instead of 'Enter Passcode', put 'Enter MyApp Passcode to continue'.
  • Consider using the light style instead of the dark style.

All in all, this might still not be enough. If you do end up getting rejected by Apple for using this library, please file an issue here and we can look at what will need to be changed to let Apple approve it.

Credits

TOPasscodeViewController was originally created by Tim Oliver as a component for iComics, a comic reader app for iOS.

iOS Device mockups used in the screenshot created by Pixeden.

License

TOPasscodeViewController is licensed under the MIT License, please see the LICENSE file. analytics

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].